<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>
<%
	Sysop sysop=(Sysop)session.getAttribute("sysop");
	if ( sysop==null)
	{
		response.sendRedirect("../index.jsp");
		return;
	}	
			
	String relativePath=request.getParameter("path");
	String module=request.getParameter("module");
	String rootUrl=SysEnv.get("web.fileUrl");
	String newDir=request.getParameter("createCate");
	
	String completePath;
	if ( relativePath==null) relativePath="";
	while (relativePath.indexOf("../")!=-1)
	relativePath=Utilities.strReplace(relativePath,"../","");
	
	String fileRoot=SysEnv.get("web.fileRoot");
	String filetail=SysEnv.get(""+module+".fileRoot");

	while (fileRoot.endsWith("\\")||fileRoot.endsWith("/"))
		fileRoot=fileRoot.substring(0,fileRoot.length()-1);
	if (fileRoot.length()<1) fileRoot="/";
	filetail=Utilities.chargePathSeparator(filetail);
	if(filetail!=null && filetail.length()>0)
		fileRoot=fileRoot+File.separator+filetail;
	
	relativePath=Utilities.chargePathSeparator(relativePath);		
	
	completePath=fileRoot+File.separator+relativePath;
	
	File path=new File(completePath);
	File dst=null;
	
	if (newDir!=null) dst=new File(path,newDir);
	String desturl="fileManage.jsp?path="+relativePath;
	if(request.getParameter("rstUrl")!=null)
		desturl=request.getParameter("rstUrl")+"?path="+relativePath+"&oldPath="+request.getParameter("oldPath")+"&module="+request.getParameter("module");	
%>	
<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="2; URL=<% out.print(desturl);%>">
<link rel="stylesheet" href="../css.css" type="text/css">
</HEAD>
<body>
<%
 if ( dst.exists()) 
 		out.print(newDir+Language.getNameByCode("fms.directory.exist"," Directory is alreay exists! Create failed!"));
 if (dst.mkdir()) 
 		out.print(newDir+Language.getNameByCode("fms.directory.create.success"," Create Successfully!"));
 else
 		out.print(newDir+Language.getNameByCode("fms.directory.create.fail"," Create Failed!"));
 %>
<body>
</html>
<%@ include file="../init_free.jsp" %>